#!/usr/bin/python2.7
#coding=utf8
import sys
class Dataformat(object):
    
    def transfer(self,str):
        formatindex={"int":"integer","date":"date","datetime":"date","bigint":"bigint"}#string(n)->varchar2(n)  decimal(m,n)->number(m,n)
        str=str.replace('"',"")
        if str in formatindex:
            return formatindex[str]
        elif str[0:str.find("(")] == "string":
            return "varchar("+str[str.find("(")+1:str.find(")")]+")"
        elif str[0:str.find("(")] == "decimal":
            xx="decimal("+str[str.find("(")+1:str.find(")")]+")"
            #index=xx.find(".")
            #xx=unicode(xx,"utf8")
            xx=xx.replace(".",",")
            return xx
        else :
            print(str[0:str.find("(")])
            print("ERROR! no this data format  at  database/mysql/conf")
            sys.exit(1)